<div>
<div class="float-left">联赛名称</div>
<div class="float-left" style="width : 400px; margin : 0 0 0 200px"><?php echo $this->league->name?></div>
</div>


<div style="clear : both; margin : 50px 0 0 0">
<div class="float-left">球队列表 : </div>
</div>
<form action="/admin/save-modify-league-team/league-id/<?php echo $this->league->id?>" method ="post">
<div style="clear : both">
<div class="table-league-team">
球队名称
</div>
<div class="float-left" style="margin:20px 0 0 120px;">
用户名称
</div>
<?php $count = 0;
for($count=0 ; $count<$this->league->team_count; $count++){
?>
<div class="table-league-team-logo-choose float-left">
	    logo
	 <img class="team_logo" src="/images/team_logo/<?php echo $this->teams[$count]['logo']?>"/>
	</div>
	<input type="hidden" name="logo_<?php echo $count +1;?>" id="team_logo_<?php echo $count +1;?>" value="<?php echo$this->teams[$count]['logo']?>" />
<div class="table-league-team">
<input type="text" name="team_<?php echo $count +1;?>"  value="<?php echo $this->teams[$count]['team_name']?>" size="20" />
</div>
<div class="table-league-team-user float-left">
     <input type="text" name="user_<?php echo $count+1;?>" id="team_user_<?php echo $count+1;?>" value="<?php echo $this->teams[$count]['username']?>" size="20" readonly="readonly" />
</div>
    <?php //if(empty($this->teams[$count]['user_id'])){?>
	<div class="table-league-team-user-choose float-left">
	    选择
	</div>
	<?php if(!empty($this->teams[$count]['user_id'])){?>
		<div class="table-league-team-user-delete float-left">
	    <a href="/admin/delete-league-user/league-id/<?php  echo $this->league->id?>/team-id/<?php echo $this->teams[$count]['team_id'];?>/user-id/<?php echo $this->teams[$count]['user_id']?>/" 
        		onclick="return confirm('确认在该联赛中删除此用户 : <?php echo $this->teams[$count]['username'];?> ？\n 此用户在该联赛中所有比赛记录将被删除');">删除</a>
	</div>
	<?php } ?>

<?php }?>
</div>
<div style="clear : both;padding : 50px 0 0 200px;">
<input id="" class="button" type="submit" value="    确定    " />
</div>
</form>

<div id="user-input-dialog">
      no display 
</div>

<div id="user-logo-dialog">
no display
</div>
</div>

<script type="text/javascript">
<!--//--><![CDATA[//><!--
jQuery.fn.center = function () {

	var top_height = ( $(window).height()-this.height() ) / 2+$(window).scrollTop();
	if(top_height<0){
		top_height=0;
	}

	this.css("top", top_height + "px");

	this.css("left", ( $(window).width()-this.width() ) / 2+$(window).scrollLeft() + "px");

	return this;

	}
	
$(document).ready(function() {
      $(".table-league-team-user-choose").each(function(){                 
    	  $(this).click(function(){
        	  $(this).addClass('chosen');

        	  var user_names=new Array(<?php echo $this->all_user_names;?>); 		      
			  var used_names_in_this_page = new Array();
			  $(".table-league-team-user").each(function(){					       
				   used_names_in_this_page.push( $(this).find('input').attr('value'));
				  
			  })  
				      
			  var all_user_ids = new Array(<?php echo $this->all_user_ids?>);				       
              var html_text = "";
              var first = true;
              var nb = 1;
              for(var name in user_names){                                   	
				if(used_names_in_this_page.indexOf(user_names[name] )==-1){
					    if(first){
						           first=false;
                            	   html_text += '<div class="user-radio-left"><input type="radio" name="user_ids" value = "' 
                                	             + user_names[name]  + '">' + user_names[name] +'</div>' ;
					    }else{
							   first=true;
							   html_text += '<div class="user-radio-right"><input type="radio" name="user_ids" value = "' 
	                  	             + user_names[name]  + '">' + user_names[name] +'</div>' ;
                        }
					    if(nb++ == 10){
							   html_text +='<div style="clear : both; height: 40px" />';
							   nb = 1;
					    }
					    
				}
              }   
    				    if(html_text==""){
        				    html_text= "对不起，没有可分配的用户";
    				    }else{
        				    
        				    html_text += '<div class="choose-user-button" ><INPUT TYPE=BUTTON OnClick="chooseTeam(' 
            				              + "'" +$('.chosen').prev().find('input').attr('id') + "'" 
            				              + ');" VALUE="选择">'
            				              + '</div><div style="float: left;margin :20px 20px 20px 90px"><INPUT TYPE=BUTTON OnClick="chooseTeam()" VALUE="关闭" ></div>'
              				              ;
    				    }
    				    $('#user-input-dialog').html(html_text);
    				    $('.chosen').removeClass('chosen');
    				 
        	  
    		  $('#user-input-dialog').fadeIn();
    		  $(".user-radio-left:even").addClass("bg-gray"); 
        	  $(".user-radio-right:odd").addClass("bg-gray"); 
      		$('#user-input-dialog').center();
          })
      });


      ///////////////////////for logo 
      $(".table-league-team-logo-choose").each(function(){                 
    	  $(this).click(function(){
        	  $(this).addClass('choisir');

        	  var html_logo_text = '<input type="radio" value="乌拉圭.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/乌拉圭.png"/>'+
     		     '<input type="radio" value="乌迪内斯.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/乌迪内斯.gif"/>'+
    		     '<input type="radio" value="佛罗伦萨.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/佛罗伦萨.gif"/>'+
    		     '<input type="radio" value="切尔西.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/切尔西.gif"/>'+
    		     '<input type="radio" value="切沃.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/切沃.gif"/>'+
    		     
    		    '<br />'+
    		     
    		     '<input type="radio" value="利物浦.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/利物浦.gif"/>'+
    		     '<input type="radio" value="加拉塔萨雷.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/加拉塔萨雷.gif"/>'+
    		     '<input type="radio" value="勒沃库森.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/勒沃库森.gif"/>'+
    		     '<input type="radio" value="南安普顿.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/南安普顿.gif"/>'+
    		     '<input type="radio" value="哥伦比亚.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/哥伦比亚.png"/>'+
    		     
    		     '<br />'+
    		          
    		     '<input type="radio" value="喀山红宝石.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/喀山红宝石.gif"/>'+
    		     '<input type="radio" value="国米.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/国米.gif"/>'+
    		     '<input type="radio" value="圣彼得堡泽尼特.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/圣彼得堡泽尼特.gif"/>'+
    		     '<input type="radio" value="埃因霍温.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/埃因霍温.gif"/>'+
    		     '<input type="radio" value="塞维利亚.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/塞维利亚.gif"/>'+
    		     
    		     '<br />'+
    		     
    		     '<input type="radio" value="多特蒙德.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/多特蒙德.gif"/>'+
    		     '<input type="radio" value="尤文.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/尤文.gif"/>'+
    		     '<input type="radio" value="巴萨.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/巴萨.gif"/>'+
    		     '<input type="radio" value="巴西.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/巴西.png"/>'+
    		     '<input type="radio" value="巴黎.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/巴黎.gif"/>'+
    		     
    		     '<br />'+
    		     
    		     '<input type="radio" value="帕纳辛奈科斯.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/帕纳辛奈科斯.gif"/>'+
    		     '<input type="radio" value="德国.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/德国.png"/>'+
    		     '<input type="radio" value="意大利.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/意大利.png"/>'+
    		     '<input type="radio" value="拉齐奥.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/拉齐奥.gif"/>'+
    		     '<input type="radio" value="拜仁.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/拜仁.gif"/>'+
    		     
    		     '<br />'+
    		          
    		     '<input type="radio" value="斯图加特.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/斯图加特.gif"/>'+
    		     '<input type="radio" value="斯旺西.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/斯旺西.gif"/>'+
    		     '<input type="radio" value="曼城.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/曼城.gif"/>'+
    		     '<input type="radio" value="曼联.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/曼联.gif"/>'+
    		     '<input type="radio" value="本菲卡.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/本菲卡.gif"/>'+
    		     
    		     '<br />'+
    		     
    		      '<input type="radio" value="桑普多利亚.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/桑普多利亚.gif"/>'+
    		     '<input type="radio" value="毕尔巴鄂竞技.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/毕尔巴鄂竞技.gif"/>'+
    		     '<input type="radio" value="沙尔克04.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/沙尔克04.gif"/>'+
    		     '<input type="radio" value="法国.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/法国.png"/>'+
    		     '<input type="radio" value="波尔图.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/波尔图.gif"/>'+
    		     
    		     '<br />'+
    		     
    		     '<input type="radio" value="波尔多.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/波尔多.gif"/>'+
    		     '<input type="radio" value="热刺.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/热刺.gif"/>'+
    		     '<input type="radio" value="皇家社会.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/皇家社会.gif"/>'+
    		     '<input type="radio" value="皇家贝蒂斯.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/皇家贝蒂斯.gif"/>'+
    		     '<input type="radio" value="皇马.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/皇马.gif"/>'+
    		     
    		     '<br />'+
    		          
    		     '<input type="radio" value="科特迪瓦.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/科特迪瓦.png"/>'+
    		     '<input type="radio" value="米兰.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/米兰.gif"/>'+
    		     '<input type="radio" value="纽卡斯尔联.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/纽卡斯尔联.gif"/>'+
    		     '<input type="radio" value="罗马.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/罗马.gif"/>'+
    		     '<input type="radio" value="英格兰.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/英格兰.png"/>'+
    		     
    		     '<br />'+
    		     
    		      '<input type="radio" value="荷兰.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/荷兰.png"/>'+
    		     '<input type="radio" value="莫斯科斯中央陆军.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/莫斯科斯中央陆军.gif"/>'+
    		     '<input type="radio" value="莫斯科斯巴达克.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/莫斯科斯巴达克.gif"/>'+
    		     '<input type="radio" value="莱万特.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/莱万特.gif"/>'+
    		     '<input type="radio" value="萨格勒布迪纳摩.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/萨格勒布迪纳摩.gif"/>'+
    		     
    		     '<br />'+
    		     
    		     '<input type="radio" value="葡萄牙.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/葡萄牙.png"/>'+
    		     '<input type="radio" value="蒙彼利埃.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/蒙彼利埃.gif"/>'+
    		     '<input type="radio" value="西班牙.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/西班牙.png"/>'+
    		     '<input type="radio" value="费内巴切.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/费内巴切.gif"/>'+
    		     '<input type="radio" value="那不勒斯.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/那不勒斯.gif"/>'+
    		     
    		     '<br />'+
    		          
    		     '<input type="radio" value="里斯本竞技.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/里斯本竞技.gif"/>'+
    		     '<input type="radio" value="阿斯顿维拉.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/阿斯顿维拉.gif"/>'+
    		     '<input type="radio" value="阿根廷.png" name="user_ids"><img class="choose-logo" src="/images/team_logo/阿根廷.png"/>'+
    		     '<input type="radio" value="阿森纳.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/阿森纳.gif"/>'+
    		     '<input type="radio" value="阿贾克斯.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/阿贾克斯.gif"/>'+
    		     
    		     '<br />'+
    		     
    		     '<input type="radio" value="顿涅茨克矿工.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/顿涅茨克矿工.gif"/>'+
    		     '<input type="radio" value="马德里竞技.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/马德里竞技.gif"/>'+
    		     '<input type="radio" value="马拉加.gif" name="user_ids"><img class="choose-logo" src="/images/team_logo/马拉加.gif"/>'+
    		     
    		      '<br />'+
    		       '<br />'+
    		     '<div class="choose-logo-button" >'+
    		     	'<INPUT TYPE="BUTTON" OnClick="chooseLogo(\''+$('.choisir').next().attr('id') + '\')" VALUE="选择">'+
    		    '</div>'+
    		     '<div style="float: left;margin :20px 20px 20px 90px">'+
    		     	'<INPUT TYPE="BUTTON" OnClick="chooseLogo()" VALUE="关闭" >'+
    		     '</div>';
        	 
    		     $('#user-logo-dialog').html(html_logo_text);
				    $('.choisir').removeClass('choisir');
        	  $('#user-logo-dialog').fadeIn();
        	  $('#user-logo-dialog').center();
    	  })
      });

});

function chooseTeam( id){
	var item = $(":radio:checked"); 
	var len=item.length; 
	if(len>0){ 	
		//alert($(":radio:checked").html()) ;
	  $('#' +id +'').attr('value',$(":radio:checked").val()); 
	  
	} 
	$('#user-input-dialog').hide();
	//$('.bModal').hide();

	//$('.bModal').attr('style','');

}

function chooseLogo( id){
	
	var item = $(":radio:checked"); 
	var len=item.length; 
	if(len>0){ 	
		//alert($(":radio:checked").html()) ;
	  $('#' +id +'').attr('value',$(":radio:checked").val()); 
	  $('#' +id +'').prev().find('img').attr('src','/images/team_logo/' + $(":radio:checked").val()); 
	} 
	$('#user-logo-dialog').hide();
	//$('.bModal').hide();

	//$('.bModal').attr('style','');

}

//--><!]]>
</script>
